package com.lb.design.pattern.factory.simplefactory;

import com.lb.design.pattern.factory.Huawei;
import com.lb.design.pattern.factory.IMobile;
import com.lb.design.pattern.factory.Samsung;

/**
 * @author lb
 * @Title: MobileFactory
 * @Description: 简单工厂模式
 * @date 2019/03/07  14:56
 */
public class MobileFactory {

    public IMobile getMobile(String name){
        String samsung = "Sansung";
        String huawei = "Huawei";
        if (huawei.equals(name)){
            return new Huawei();
        }else if (samsung.equals(name)){
            return new Samsung();
        }
        return null;
    }
}
